package com.my.service;

import com.my.mapper.StudentMapper;
import com.my.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService{

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Student> findAll() {
        List<Student> students=studentMapper.findAll();
        return students;
    }

    @Override
    public  List<Student> likeStudent(String sname) {
        List<Student> students=studentMapper.likeStudent(sname);
        return students;
    }

    @Override
    public int insertTo(Student student) {
        int i=studentMapper.insertTo(student);
        return i;
    }

    @Override
    public int updateTo(Student student) {
        int i=studentMapper.updateTo(student);
        return i;
    }

    @Override
    public int deleteTo(Integer id) {
        int i=studentMapper.deleteTo(id);
        return i;
    }

    @Override
    public Student findById(Integer id) {
        Student student=studentMapper.findById(id);
        return student;
    }
}